package ru.study.thinkin.chapter11;

import java.util.*;

public class PrirityQueueDemo {

	public static void main(String[] args) {
		PriorityQueue priority = new PriorityQueue();
		Random rand  = new Random(50);
		for(int i = 0;i<5;i++) {
			int val = rand.nextInt(i+10);
			priority.offer(val);
		}
		QueueDemo.printQ(priority);
		
		List<Integer> ints = new ArrayList(Arrays.asList(25,22,20,18,14,9,23,24));
		priority = new PriorityQueue(ints);
		QueueDemo.printQ(priority);
		
		priority = new PriorityQueue<Integer>(ints.size(),Collections.reverseOrder());
		priority.addAll(ints);
		QueueDemo.printQ(priority);
		
		String fact = "EDUCATION SHOULD BE ESCHEW";
		List<String> strings = Arrays.asList(fact.split(" "));
		PriorityQueue<String> stringPQ = new PriorityQueue<String>(strings);
		QueueDemo.printQ(stringPQ);
		
		stringPQ = new PriorityQueue<String>(strings.size(),Collections.reverseOrder());
		stringPQ.addAll(strings);
		QueueDemo.printQ(stringPQ);
		

	}

}
